<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改业务需求信息')" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-businessInfo-edit" th:object="${businessInfo}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">业务名称：</label>
                <div class="col-sm-8">
                    <input name="businessName" th:field="*{businessName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">业务说明：</label>
                <div class="col-sm-8">
                    <textarea name="businessDescription" class="form-control">[[*{businessDescription}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用况：</label>
                <div class="col-sm-8">
                    <select name="usageId" id="usageId" class="form-control selectpicker" multiple data-live-search="true" title="请选择">
                        <option th:each="usageInfo : ${usageInfoList}" th:text="${usageInfo.usageyName}" th:value="${usageInfo.id}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否是问题：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_yes_no')}">
                        <input type="radio" th:id="${'isQuestion_' + dict.dictCode}" name="isQuestion" th:value="${dict.dictValue}" th:field="*{isQuestion}">
                        <label th:for="${'isQuestion_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">需求类型：</label>
                <div class="col-sm-8">
                    <select name="businessType" class="form-control m-b" th:with="type=${@dict.getType('businessType')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{businessType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">紧急程度：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('degree')}">
                        <input type="radio" th:id="${'degree_' + dict.dictCode}" name="degree" th:value="${dict.dictValue}" th:field="*{degree}">
                        <label th:for="${'degree_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">重要程度：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('degree')}">
                        <input type="radio" th:id="${'important_' + dict.dictCode}" name="important" th:value="${dict.dictValue}" th:field="*{important}">
                        <label th:for="${'important_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实现必要性：</label>
                <div class="col-sm-8">
                    <textarea name="implementationNecessity" class="form-control">[[*{implementationNecessity}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实现客户必要性：</label>
                <div class="col-sm-8">
                    <textarea name="implementationCustomerNecessity" class="form-control">[[*{implementationCustomerNecessity}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">实现公司必要性：</label>
                <div class="col-sm-8">
                    <textarea name="implementationCampanyNecessity" class="form-control">[[*{implementationCampanyNecessity}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-3 control-label is-required">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script th:inline="javascript">
        var prefix = ctx + "business/businessInfo";
        $("#form-businessInfo-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $('#form-businessInfo-edit').serializeArray();
                var usageIds = $('#usageId').selectpicker('val');
                data.push({"name": "usageIds", "value": usageIds});
                $.operate.save(prefix + "/edit", data);
            }
        }
        var usageIds = [[${usageIds}]]
        $(function () {
            $('#usageId').selectpicker('val', usageIds);
        });
    </script>
</body>
</html>